package me.xplabs.gemo 
{
	/**
	 * http://www.xplabs.me/
	 * @author xiaohan
	 */
	public class Point2D 
	{
		public var x:Number;
		public var y:Number;
		public function Point2D(x:Number = 0, y:Number = 0)
		{
			this.x = x;
			this.y = y;
		}
		public function distance(pt:Point2D):Number
		{
			return Math.sqrt((pt.x - x) * (pt.x - x) + (pt.y - y) * (pt.y - y));
		}
		public function clone():Point2D
		{
			return new Point2D(x, y);
		}
		public function offset(dx:Number = 0, dy:Number = 0):void
		{
			x += dx;
			y += dy;
		}
		public function setXY(x:Number = 0, y:Number = 0):void
		{
			this.x = x;
			this.y = y; 
		}
		public function setPos(pt:Point2D):void
		{
			this.x = pt.x;
			this.y = pt.y;
		}
		public function toString():String
		{
			return "(x=" + x + ",y=" + y +")";
		}
	}

}